﻿
using Microsoft.Xna.Framework;

namespace SomeGame.Tools {

	public static class GraphicsExtensions {

		//=====( Begin XNA Rectangle )=============================================================

        public static bool IntersectsRight(this Rectangle me, ref Rectangle you) {
            return me.Right > you.Right;
        }

        public static bool IntersectsLeft(this Rectangle me, ref Rectangle you) {
            return me.Left < you.Left;
        }

        public static bool IntersectsTop(this Rectangle me, ref Rectangle you) {
            return me.Top < you.Top;
        }

        public static bool IntersectsBottom(this Rectangle me, ref Rectangle you) {
            return me.Bottom > you.Bottom;
        }

        public static Rectangle SetXFromPosition(this Rectangle me, ref Vector2 position) {
            me.X = (int)position.X;
            return me;
        }

		//=====( End XNA Rectangle )===============================================================
        ///////////////////////////////////////////////////////////////////////////////////////////
        //=====( Begin Vector2 )===================================================================

        public static Vector2 SetXAfterRightCollision(this Vector2 me, ref Rectangle myBounds, ref Rectangle yourBounds) {
            me.X = yourBounds.Right-myBounds.Width;
            return me;
        }

        public static Vector2 SetXAfterLeftCollision(this Vector2 me, ref Rectangle yourBounds) {
            me.X = yourBounds.Left;
            return me;
        }

        //=====( End Vector2 )=====================================================================
	}

}